swarm cannot remove network 解决记录

1 需要克隆编译https://github.com/docker/swarmkit出swarmctl工具:[参考](https://github.com/moby/moby/issues/31068)

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
[root@swarm_33 swarm_tool]# docker network ls
NETWORK ID NAME DRIVER SCOPE
06f556421f34 bridge bridge local
p2phsx026ar8 ditto_overlay overlay swarm
03e4d3882466 docker_gwbridge bridge local
o36a746nmoip etcd_overlay overlay swarm
a8d4b77367fd host host local
sdfb7wc24ifn ingress overlay swarm
0d0a3cd18b38 none null local
pz316m31e9eu ssy_test overlay swarm
[root@swarm_33 swarm_tool]# docker network rm etcd_overlay
Error response from daemon: rpc error: code = FailedPrecondition desc = network o36a746nmoipw3gimf4l361b0 is in use by task y8zcd7tjulw1bl2yqhj6ig1ht
[root@swarm_33 swarm_tool]# docker network rm etcd_overlay
Error response from daemon: rpc error: code = FailedPrecondition desc = network o36a746nmoipw3gimf4l361b0 is in use by task y8zcd7tjulw1bl2yqhj6ig1ht
[root@swarm_33 swarm_tool]# ./swarmctl task ls
ID Service Desired State Last State Node
-- ------- ------------- ---------- ----
030k25yjhjtr5xedry24wsff8 brain_kafka2.1 RUNNING RUNNING 17 hours ago swarm_44
2fx3pve9dr6ra8xop3gu0c5zw brain_zoo3.1 RUNNING RUNNING 17 hours ago swarm_47
76003j8n32bu1rn3p2lhrwf95 client.1 RUNNING RUNNING 17 hours ago swarm_33
7vhuzv8l0gz5cbt5ti0mbulq5 brain_zoo2.1 RUNNING RUNNING 17 hours ago swarm_44
jdjem1t1nuhr94i5f07987pxh brain_kafka3.1 RUNNING RUNNING 17 hours ago swarm_47
pmvm6qc90np1j0mc7hjw8oefw brain_kafka1.1 RUNNING RUNNING 17 hours ago swarm_34
rkoxo2ittpz6xhi4e2cn1cxte brain_zoo1.1 RUNNING RUNNING 17 hours ago swarm_34
y8zcd7tjulw1bl2yqhj6ig1ht .0 RUNNING RUNNING 20 hours ago swarm_44

[root@swarm_33 swarm_tool]# ./swarmctl task inspect y8zcd7tjulw1bl2yqhj6ig1ht
ID : y8zcd7tjulw1bl2yqhj6ig1ht
Slot : 0
Service :
Status
Desired State : RUNNING
Last State : RUNNING
Timestamp : 2020-02-26T06:58:04.564125645Z
Message : started
Node : swarm_44
Spec
panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x0 pc=0xaa04cb]

goroutine 1 [running]:
github.com/docker/swarmkit/cmd/swarmctl/task.printTaskSummary(0xc000252000, 0xc00018dce0)
/home/jinri/gopath/src/github.com/docker/swarmkit/cmd/swarmctl/task/inspect.go:67 +0x4cb
github.com/docker/swarmkit/cmd/swarmctl/task.glob..func1(0x12354e0, 0xc000077f10, 0x1, 0x1, 0x0, 0x0)
/home/jinri/gopath/src/github.com/docker/swarmkit/cmd/swarmctl/task/inspect.go:137 +0x47f
github.com/docker/swarmkit/vendor/github.com/spf13/cobra.(*Command).execute(0x12354e0, 0xc000077eb0, 0x1, 0x1, 0x12354e0, 0xc000077eb0)
/home/jinri/gopath/src/github.com/docker/swarmkit/vendor/github.com/spf13/cobra/command.go:565 +0x3b7
github.com/docker/swarmkit/vendor/github.com/spf13/cobra.(*Command).ExecuteC(0x1235ae0, 0xc21d00, 0xc3cad8, 0x33)
/home/jinri/gopath/src/github.com/docker/swarmkit/vendor/github.com/spf13/cobra/command.go:656 +0x330
main.main()
/home/jinri/gopath/src/github.com/docker/swarmkit/cmd/swarmctl/main.go:20 +0x3f

[root@swarm_33 swarm_tool]# ./swarmctl task rm y8zcd7tjulw1bl2yqhj6ig1ht
y8zcd7tjulw1bl2yqhj6ig1ht
[root@swarm_33 swarm_tool]# docker inspect --type task y8zcd7tjulw1bl2yqhj6ig1ht
[]
Error: No such task: y8zcd7tjulw1bl2yqhj6ig1ht
[root@swarm_33 swarm_tool]# ./swarmctl task inspect y8zcd7tjulw1bl2yqhj6ig1ht
Error: task y8zcd7tjulw1bl2yqhj6ig1ht not found

[root@swarm_33 swarm_tool]# docker network ls
NETWORK ID NAME DRIVER SCOPE
06f556421f34 bridge bridge local
p2phsx026ar8 ditto_overlay overlay swarm
03e4d3882466 docker_gwbridge bridge local
o36a746nmoip etcd_overlay overlay swarm
a8d4b77367fd host host local
sdfb7wc24ifn ingress overlay swarm
0d0a3cd18b38 none null local
pz316m31e9eu ssy_test overlay swarm
[root@swarm_33 swarm_tool]# docker network rm etcd_overlay
etcd_overlay
[root@swarm_33 swarm_tool]# docker network ls
NETWORK ID NAME DRIVER SCOPE
06f556421f34 bridge bridge local
p2phsx026ar8 ditto_overlay overlay swarm
03e4d3882466 docker_gwbridge bridge local
a8d4b77367fd host host local
sdfb7wc24ifn ingress overlay swarm
0d0a3cd18b38 none null local
pz316m31e9eu ssy_test overlay swarm